class StudentGroupLink < ActiveRecord::Base
  attr_accessible :student_id, :student_group_id
  belongs_to :student_group
  belongs_to :student
  def self.check_admin(uid)
    #self.find_by_student_id(uid, :joins => 'LEFT JOIN student_groups ON student_groups.id = student_group_links.group_id')
    res = StudentGroupLink.find_by_student_id_and_student_group_id(uid, StudentGroup.find_by_name('admin'), :include => :student_group)
    return false if res.nil?
    return res
  end
end
